<!-- 路由管理 - 综合表单页面 -->
<template>
  <div class="page-container">
    <ex_super_table_page v-bind="option" ref="SuperTablePage">
    </ex_super_table_page>
    <ex_super_dialog_form ref="formDialog" :title="dialogTitle" v-bind="dialog"
      @afterSubmitSuccess="$refs['SuperTablePage'].reload()" />
  </div>
</template>
<script>
  import superTablePageFunction from '@/mixin/super-table-page-function';
  let moduleName = "路由管理"

  export default {
    title:moduleName,
    mixins: [superTablePageFunction],
    components: {},
    data() {
      return {

        option: {
          //搜索框内容
          search: {
            //搜索框内容，key为搜索字段，label为标签提示
            model: [
              { label: "文字输入", key: "k1", type: 'input', attrs: { placeholder: '请输入', }, },//普通文字输入
              {
                label: "固定选择下拉器", key: "k2", type: 'select',//普通固定选择
                items: [{ label: '启用', value: 'v1' }, { label: '禁用', value: 'v2' }]//label为显示内容，value为筛选内容
              },
              {
                label: "固定多选下拉器", key: "k3", type: 'select',attrs:{multiple:true},//普通多选选择
                items: [{ label: '标签1', value: 'v1' }, { label: '标签2', value: 'v2' }, { label: '标签3', value: 'v3' }]//label为显示内容，value为筛选内容
              },
              {
                label: "远程选择器", key: "k4", type: 'select',//自动从远程url获取列表内容
                url: '/ums-api/test/test/test.json', //url路径
                option: { label: 'name', value: 'id' },//用于标记回传列表内的显示字段与筛选字段，label为显示，value为筛选
              },
              {
                label: "枚举选择器", key: "k14", type: 'select',enum:'WarehouseTypeEnum',//自动获取后台枚举内容，enum为定义的枚举类
              },
              {
                label: "时间选择", key: "k5", type: 'time-picker', //日期选择
                attrs: { placeholder: '请选择时间', },
              },
              {
                label: "日期选择", key: "k6", type: 'date-picker', //日期选择
                attrs: { placeholder: '请选择日期', },
              },
              {
                label: "日期时间选择", key: "k7", type: 'date-picker', //日期选择
                attrs: { placeholder: '请选择日期时间',type:"datetime" },
              },
              //所有元素均可添加可选attrs对象增加属性，详细属性列表由element-ui提供
            ],
          },
          action: [
            {
              label: '新增' + moduleName, attrs: { icon: "el-icon-plus" }, click: () => {
                this.dialogTitle = '新增' + moduleName
                this['$refs']['formDialog'].show(null,true)
              }
            },
          ],

          table: {
            url: "/tms-api/base/TmsRouteInfoRpc/selectByPage.json",
            attrs: {},
            model: [
              { key: 'routeName', label: '路由名称', },
              { key: 'lineId', label: '线路id', },
              { key: 'lineName', label: '线路名称', },
              { key: 'isQuote', label: '是否被方案引用', },
              { key: 'status', label: '状态', },
              { key: 'routeNumber', label: '路由段数', },
              { key: 'creator', label: '创建人', },
              { key: 'gmtCreate', label: '创建时间', },
            ],
            operate: [
              {
                label: '编辑', click: (row) => {
                  this.dialogTitle = '编辑' + moduleName
                  this['$refs']['formDialog'].show({"id": row["id"]},false)
                }
              },
              {
                label: '删除', type: "confirm-button", url: '/tms-api/base/TmsRouteInfoRpc/remove.json', message: '确定要删除该记录吗？',
                params: (row) => { return {"id": row["id"]} }, done: ['reload', 'tip']
              },
            ],
          }
          ,

        },

        dialogTitle: '',
        dialog: {
          submitUrl: '/tms-api/base/TmsRouteInfoRpc/saveUpdate.json',
          detailUrl: '/tms-api/base/TmsRouteInfoRpc/detail.json',
          form: {
            //弹窗表单设置，设置方式与搜索框对象一致。
            model: [
              { header: "基础信息", },
              { key: 'routeName', label: '路由名称', },
              { key: 'lineId', label: '线路id', },
              { key: 'lineName', label: '线路名称', },
              { key: 'isQuote', label: '是否被方案引用', },
              { key: 'status', label: '状态', },
              { key: 'routeNumber', label: '路由段数', },
              { key: 'creator', label: '创建人', },
              { key: 'gmtCreate', label: '创建时间', },
            ],
            rules: {
              'routeName': [{ required: true, message: '请输入路由名称', trigger: 'blur' }],
              'lineId': [{ required: true, message: '请输入线路id', trigger: 'blur' }],
              'lineName': [{ required: true, message: '请输入线路名称', trigger: 'blur' }],
              'isQuote': [{ required: true, message: '请输入是否被方案引用', trigger: 'blur' }],
              'status': [{ required: true, message: '请输入状态', trigger: 'blur' }],
              'routeNumber': [{ required: true, message: '请输入路由段数', trigger: 'blur' }],
              'creator': [{ required: true, message: '请输入创建人', trigger: 'blur' }],
              'gmtCreate': [{ required: true, message: '请输入创建时间', trigger: 'blur' }],
            },
          }
        },
      };
    },
    methods: {
    }
  };

</script>
<style>

</style>
